﻿namespace AjLogo.Primitives
{
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using AjLogo.Language;

    public abstract class UnaryPrimitive : IProcedure
    {
        public int Arity { get { return 1; } }

        public object Evaluate(BindingEnvironment environment, params object[] parameters) 
        {
            object value;

            if (parameters.Length > 0)
                value = parameters[0];
            else
                value = null;

            return this.Apply(environment, value);
        }

        public abstract object Apply(BindingEnvironment environment, object value);
    }
}

